﻿<UserControl x:Class="MissedMemo.MeatAndCheeseDisc.OrderEntry.viewOrderEditPanel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MissedMemo.MeatAndCheeseDisc.OrderEntry"
    Height="300" Width="400">
    
    <UserControl.Resources>
        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="resColors.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <Style x:Key="OrderEditPanelStyle" TargetType="Border" >
                <Setter Property="Background" Value="{StaticResource brushOrderEditPanelBackground}" />
                <Setter Property="BorderBrush" Value="{StaticResource brushOrderEditPanelBorder}" />
                <Setter Property="BorderThickness" Value="2" />
                <Setter Property="Margin" Value="5" />
                <Setter Property="CornerRadius" Value="4" />
            </Style>

            <Style x:Key="OKCancelButtonPanelStyle" TargetType="DockPanel" >
                <Style.Resources>
                    <Style TargetType="Button">
                        <Setter Property="DockPanel.Dock" Value="Right" />
                        <Setter Property="Width" Value="90" />
                        <Setter Property="Height" Value="23" />
                    </Style>
                </Style.Resources>
                <Setter Property="LastChildFill" Value="false" />
            </Style>

            <local:FormattedTextConverter x:Key="FormattedTextConverter" />
            
        </ResourceDictionary>
    </UserControl.Resources>

    
    <Border Style="{StaticResource OrderEditPanelStyle}" >

        <Grid Margin="10">

            <Grid.RowDefinitions>
                <RowDefinition Height="24" />
                <RowDefinition Height="*" />
                <RowDefinition Height="auto" MinHeight="33" />
            </Grid.RowDefinitions>

            <TabControl Name="tabControl" Grid.Row="0" Grid.RowSpan="2" >
                <TabItem Header="{Binding NowServingNumber, Converter={StaticResource FormattedTextConverter}, ConverterParameter='Order# {0}'}"
                         IsSelected="True" MinHeight="18" MinWidth="40" >
                    <local:viewOrderDetails x:Name="orderDetails" Width="auto" Height="auto" />
                </TabItem>
                <TabItem Header="{Binding Customer.Name}"  MinHeight="18" MinWidth="40" >
                    <local:viewCustomerDetails x:Name="customerDetails" Width="auto" Height="auto" />
                </TabItem>
            </TabControl>

            <CheckBox HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,50,0"
                      Content="Delivery" IsChecked="{Binding DeliveryRequested}" />

            <DockPanel Grid.Row="2" Margin="0,10,0,0" Style="{StaticResource OKCancelButtonPanelStyle}" >
                <Button Content="Cancel" Click="OnDone" Margin="3,0,0,0" />
                <Button Content="Save Changes" Click="OnDone" Command="ApplicationCommands.Save" IsEnabled="{Binding UnsavedChanges}"/>
            </DockPanel>

        </Grid>

    </Border>


</UserControl>
